package hibernate_basic.Zexercise.topic03;

import hibernate_basic.Persistence.comment_persitence.Person;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;

/**
 * @author Administrator
 * @create 2019-01-01 11:21
 * @desc 删除员工信息
 **/
public class Delete {

    public static void main(String args[]){
        Configuration config=new Configuration();
        config.configure("hibernate_basic/Zexercise/topic02/config/hibernate.cfg.xml");
        SessionFactory factory=config.buildSessionFactory();
        Session session=factory.openSession();
        Transaction tion=session.beginTransaction();
        Person person=session.get(Person.class,15);

        session.delete(person);

        tion.commit();

        session.close();
    }
}
